home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2002 #4 / K-CD-4-2002.ISO / Empire Earth / EEDemo.exe / Disk1 / data.ssa / unit ai scripts_stationary target tracking.tai < prev    next >
Encoding:
Text File  |  2001-09-29  |  2.2 KB  |  74 lines

  1. //
  2. //    Stationary Target Tracking AI file
  3. //
  4. //    Behaviors:
  5. //
  6. //        If idle, look periodically for enemy units to target.
  7. //        Track enemy units and attack while in weapon range.
  8. //        Continue tracking while in LOS.
  9. //        When target leaves LOS, return to idle.
  10. //
  11. //    Notes:
  12. //
  13. //        This behavior is mainly used for stationary units like guard towers.
  14. //
  15. //    Common modifications:
  16. //
  17. //    Known Problems:
  18. //
  19. //        Units will track an enemy unit outside weapon range even if there
  20. //            are other enemy units *within* weapon range.  MUST FIX THIS!
  21. //
  22. //    Usage:
  23. //
  24. //        To tell a unit to attack another unit, give it an attack goal (EEUGAttackUnit or EEUGAttackGround)
  25. //            and set it's action to keeuaTrackEnemyUnit.
  26. //
  27.  
  28. // any tasty enemies around?
  29. Idle
  30. {
  31.     EnemyUnitSpotted true(TrackEnemyUnit)
  32. }
  33.  
  34. // follow enemy unit (perhaps with a turret?) until it's in weapon range or moves away
  35. TrackEnemyUnit
  36. {
  37.     anyof(EnemyUnitDestroyed,CeaseFire,UnitNotOnMap,EnemyUnitNoLongerVisible,EnemyWithinMinimumRange) true(Idle)
  38.     allof(Reloaded,UnitInWeaponRange) true(AttackEnemyUnit)
  39.     EnemyUnitLeftLOS true(Idle)
  40.  
  41.     // the next trigger allows the tower to respond to attacks, but only if it's attacking on it's own
  42.     // note that the "EnemyIsBuilding" trigger is left out here - don't let 'em fool us by keeping a unit just out of range
  43.     allof(AmIUnderAttack,GoalIsNotPlayerInitiated,UnitNotInWeaponRange) true(UnderAttack)
  44. }
  45.  
  46. // attack enemy unit unti it dies or moves away
  47. AttackEnemyUnit
  48. {
  49.     anyof(EnemyUnitDestroyed,CeaseFire,UnitNotOnMap,EnemyUnitNoLongerVisible,EnemyWithinMinimumRange) true(Idle)
  50.     UnitInWeaponRange false(TrackEnemyUnit)
  51.     EnemyUnitLeftLOS true(Idle)
  52.  
  53.     // the next trigger allows the tower to respond to attacks, but only if it's attacking a building on it's own
  54.     allof(AmIUnderAttack,GoalIsNotPlayerInitiated,EnemyIsBuilding) true(UnderAttack)
  55.  
  56.     AlwaysTrue true(TrackEnemyUnit)
  57. }
  58.  
  59. RetaliateAgainstAttacker
  60. {
  61.     allof(GoalIsUnit,UnitInWeaponRange) true(TrackEnemyUnit) false(Idle)
  62. }
  63.  
  64. UnderAttack
  65. {
  66.     allof(UnitInWeaponRange,CanDamageAttacker) true(RetaliateAgainstAttacker) false(Idle)
  67. }
  68.  
  69. // attack the target until it is destroyed or moves
  70. InitialAttackState
  71. {
  72.     AlwaysTrue true(TrackEnemyUnit)
  73. }
  74.